import Vue from 'vue'
import VueRouter from 'vue-router'
//登录页面
import login from '../components/login.vue'
//首页
import index from '../components/index.vue'
//引入icon图标
import '../assets/icon/iconfont.css'

//商品页面
import Goods from '../views/goods/Goods.vue'
//交易订单页面
import Order from '../views/pay/Order.vue'
//支付配置页面
import Config from '../views/pay/Config.vue'
//支付配置信息
import Machine from '../views/machine/MachineConfig.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login',
    meta: {
      requireAuth: false
    }
  },
  {
    path: '/login',
    component: login,
    meta: {
      requireAuth: false
    }
  }, {
    path: '/index',
    component: index,
    children: [{
      path: '/goods/Goods',
      component: Goods,
      meta: {
        requireAuth: true
      }
    },
    {
      path: '/pay/Order',
      component: Order,
      meta: {
        requireAuth: true
      }
    },
    {
      path: '/pay/Config',
      component: Config,
      meta: {
        requireAuth: true
      }
    },
    {
      path: '/machine/MachineConfig',
      component: Machine,
      meta: {
        requireAuth: true
      }
    }

    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
